<template>
  <div class="delivery">
    <el-table
      :data="tableData"
      style="width: 100%"
      size="mini"
      :header-cell-style="headercellstyle"
    >
      <el-table-column prop="expressName" :label="$t('caseorder.yulan.yulan57')" />
      <el-table-column prop="expressNo" :label="$t('caseorder.yulan.yulan58')" />
      <el-table-column prop="date3" :label="$t('caseorder.yulan.yulan59')" />
      <el-table-column prop="date4" :label="$t('caseorder.yulan.yulan60')" />
      <el-table-column prop="date4" :label="$t('caseorder.yulan.yulan61')" />
      <el-table-column prop="phone" :label="$t('caseorder.yulan.yulan62')" />
      <el-table-column prop="date4" :label="$t('caseorder.yulan.yulan63')" min-width="100px" />
      <el-table-column prop="remark" :label="$t('caseorder.yulan.yulan64')" />
      <el-table-column :label="$t('caseorder.yulan.yulan65')" min-width="130px">
        <template slot-scope="scope">
          <el-button type="text" :size="tableButtonSize" @click="copyHandle(scope.row.expressNo)">{{
            $t('caseorder.yulan.yulan66')
          }}</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  // 订单发货
  name: 'BLZMasterDelivery',

  data() {
    return {
      tableData: [],
    };
  },

  created() {},

  methods: {
    copyHandle(val) {
      // 创建input标签
      var input = document.createElement('input');
      // 将input的值设置为需要复制的内容
      input.value = val;
      // 添加input标签
      document.body.appendChild(input);
      // 选中input标签
      input.select();
      // 执行复制
      document.execCommand('copy');
      // 成功提示信息
      this.$message.success(this.$t('caseorder.anli96'));
      // 移除input标签
      document.body.removeChild(input);
    },
    shippingList(id) {
      this.$http
        .get(`/express/shippingList?orderId=${id}`)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          } else {
            this.tableData = res.data;
          }
        })
        .catch((err) => {
          console.log('err', err);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.delivery {
  padding: 15px 0;
}
</style>
